/*

Author   : chaos

FileName : elif.cpp

Date     : 17/08/17 22:14:12

*/
#include <iostream>
using namespace std;

#define A
#define B

void fun1(void){
    cout << endl << "In fun1 --------------" << endl;
#if (defined A) && (defined B)
    cout << "A and B is defined" << endl;
#elif (defined A)
    cout << "only A is defined !" << endl;
#elif (defined B)
    cout << "only B is defined !" << endl;
#else
    cout << "A and B is not defined !" << endl;
#endif

}

int main(int argc ,char *argv[])
{
    void fun2(void);
#undef A

    cout << "In main --------------------" << endl;


#if (defined A) && (defined B)
    cout << "A and B is defined" << endl;
#elif (defined A)
    cout << "only A is defined !" << endl;
#elif (defined B)
    cout << "only B is defined !" << endl;
#else
    cout << "A and B is not defined !" << endl;
#endif

    fun1();
    fun2();

    return 0;
#undef B
}

void fun2(void)
{

    cout << endl << " In fun2 ---------------" << endl;


#if (defined A) && (defined B)
    cout << "A and B is defined" << endl;
#elif (defined A)
    cout << "only A is defined !" << endl;
#elif (defined B)
    cout << "only B is defined !" << endl;
#else
    cout << "A and B is not defined !" << endl;
#endif
}
